<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>选择品牌</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../../include/commonFile.jsp" %>
    <style type="text/css">
        .index-outside > section .section-main {
            min-width: 0px !important;
            padding: 0px 15px;
        }

        .index-outside > section {
            padding-bottom: 0px !important;
        }
    </style>
</head>
<body>
<!--头部-->
<div class="index-outside">
    <!--内容-->
    <section class="no-fix">
        <div class="section-main">
            <form class="layui-form" action="${ctx}/mall/brand/selectBrand.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">品牌名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input" value="${mallGoodsBrand.name}" placeholder="品牌名称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger" href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal" href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="c-time-list-content" style="padding-top: 0px;">
                <input type="hidden" id="selectDatas"/>
                <ul>
                    <table class="layui-table layui-form" lay-skin="line">
                        <colgroup>
                            <col width="50px">
                            <col>
                            <col width="100px">
                            <%--<col width="150px">--%>
                        </colgroup>
                        <thead>
                        <tr>
                            <th></th>
                            <th>品牌名称</th>
                            <th>商品数量</th>
                            <%--<th>创建时间</th>--%>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="mgb" items="${list}">
                            <tr data-id="${mgb.id}" data-pic="${mgb.logo}" data-name="${mgb.name}">
                                <td>
                                    <input type="checkbox" name="id" value="${mgb.id}" lay-filter="chk" lay-skin="primary">
                                </td>
                                <td class="ellipsis-1" title="${mgb.name}">${mgb.name}</td>
                                <td class="ellipsis-1">${mgb.goodsNum}</td>
                                <%--<td class="ellipsis-1"><fmt:formatDate value="${mgb.createDate}" pattern="yyyy-MM-dd HH:mm"/></td>--%>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </ul>
            </div>
            <div id="page_content" class="page-container"></div>
        </div>
    </section>
</div>
<!--底部-->
<%@include file="../../include/incScript.jsp" %>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    $(function () {
        // 加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        $("#submitBtn").click(function () {
            $("#myForm").submit();
        });

        $("#resetBtn").click(function () {
            $("#myForm input[type=text]").val("");
        });

        layui.use(['form'], function () {
            var form = layui.form
        });
    });

    function doSubmit() {
        var length = $("[name=id]:checked").length;
        if (length == 0) {
            util.layerMsgError("请先选择")
            return false;
        }
        var _result = new Array();
        $("[name=id]:checked").each(function (index, ele) {
            var $tr = $(ele).closest("tr");
            var map = {
                targetId: $tr.data("id"),
                name: $tr.data("name"),
                pic: $tr.data("pic"),
                type: 5
            };
            _result.push(map);
        });
        $("#selectDatas").val(JSON.stringify(_result));
        return true;
    }
</script>
</body>
</html>